<template>
  <div>
    <tree-item v-for="(child, index) in treeData" :treeItem="child" :key="index" />
  </div>
</template>

<script>
import TreeItem from './TreeItem';

export default {
  components: {
    TreeItem
  },
  data() {
    return {
      treeData: [
        {
          text: '一级', // 显示的文字
          expand: false, // 默认是否展开
          children: [
            // 子节点
            {
              text: '一级-1',
              expand: false
            },
            {
              text: '一级-2',
              expand: false,
              children: [
                {
                  text: '一级-2-1',
                  expand: false
                },
                {
                  text: '一级-2-2',
                  expand: false
                }
              ]
            }
          ]
        }
      ]
    }
  }
}
</script>
